<template>
  <div id='video01_table'
       v-infinite-scroll="loadMore"
       infinite-scroll-disabled="busy"
       infinite-scroll-distance="0"
       infinite-scroll-immediate-check="false">
    <p class="no_data"
       v-if="response_comment.length==0">目前没有可以查看的数据哟~</p>
    <div v-for='(item,index) in response_comment'
         :key='index+"data01"'>
      <img :src="item.logo">
      <section>
        <p>{{item.nickname}}</p>
        <p>{{item.content}}</p>
        <p>{{timestamp(item.comment_time, 'Y-M-D h:m:s')}}</p>
      </section>
      <div>
        <img src="@/assets/meng/l.png">
        <p>{{format_num(item.digg_count)}}</p>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'video01_table',
  components: {},
  props: ['id'],
  data() {
    return { page: 1, response_comment: [], busy: false }
  },
  computed: {},
  created() {
    this.get_data01()
  },
  mounted() {},
  methods: {
    //    视频评论
    get_data01() {
      let that = this
      this.busy = true
      this.$axios({
        method: 'get',
        url: '/api/aweme/comment',
        params: {
          awemeid: that.id,
          page: that.page,
          size: 20,
          order_by: 'desc',
          sort: 'DiggCount',
        },
      })
        .then((response) => {
          if (response.data.code == 0) {
            // console.log(response.data.data)
            this.response_comment = this.response_comment.concat(
              response.data.data
            )

            this.page += 1
            response.data.data.length < 20
              ? (this.busy = true)
              : (this.busy = false)
          }
        })
        .catch((error) => {
          console.log(error)
        })
    },
    loadMore() {
      this.get_data01()
    },
  },
}
</script>
<style scoped lang='less'>
#video01_table {
  height: 528px;
  width: 100%;
  overflow: auto;
  .no_data {
    line-height: 439px;
    color: #fd7f2c !important;
    font-size: 16px !important;
    text-align: center;
  }
  > div {
    > div {
      width: 73px;
      text-align: center;
      img {
        width: 18px;
      }
      p {
        color: #222222;
      }
    }
    > section {
      width: 100%;
      > p:nth-child(1) {
        font-size: 14px;
        color: #888888;
      }
      > p:nth-child(2) {
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 14px;
        color: #222222;
      }
      > p:nth-child(3) {
        font-size: 12px;
        color: #888888;
      }
    }
    > img {
      margin-left: 40px;
      width: 50px;
      height: 50px;
      margin-right: 9px;
      border-radius: 50%;
    }
    height: 90px;
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    align-items: center;
    width: 100%;
  }
}
</style>